#include "logger.hpp"
#include "helper.hpp"

int main()
{
    //测试日志logger  
    LOG(logLevel::DEBUG) << "hello world" << std::endl;

    //测试字符串分割
    std::vector<std::string> vt;
    std::string str("...man!.what can i say..manba out");
    StringHelper::split(str, ".", &vt);

    for (auto &st : vt)
    {
        std::cout << st << std::endl;
    }

    //测试UUID生成
    std::cout << UuidHelper::uuid() << std::endl;
    std::cout << UuidHelper::uuid() << std::endl;
    std::cout << UuidHelper::uuid() << std::endl;

    //测试文件操作工具 -- 测试文件是否存在
    FileHelper file("/home/yyc/shiratamaco/newStudy/MyRabbitMQ/test.txt");
    std::cout << file.exists() << std::endl;

    FileHelper file2("test.txt");
    std::cout << file2.exists() << std::endl;

    FileHelper file1("/home/yyc/shiratamaco/newStudy/MyRabbitMQ/test1.txt");
    std::cout << file1.exists() << std::endl;

    //测试文件大小
    std::cout << file.size() << std::endl;

    //测试文件读取
    std::string buffer;
    file.readAll(buffer);

    std::cout << buffer << std::endl;

    //测试文件写入
    std::string outBuffer{"测试写入逻辑"};
    file.writeAll(outBuffer);

    //获取文件父目录
    std::cout << FileHelper::parentDirectory("test.txt") << std::endl;

    //创建文件
    FileHelper::createFile("newTest.txt");
    FileHelper helper("newTest.txt");

    //修改文件名称
    helper.rename("test_rename.txt");

    //删除文件
    FileHelper::removeFile("test_rename.txt");

    //创建目录
    FileHelper::createDirectory("./man/what/can/i/say");
    
    //删除目录
    FileHelper::removeDirectory("./man");

    

    return 0;
}